/**
 * @author gaopeng
 * @date 2019/12/12 11:15 下午
 */
public class Stock extends AbstractColleague {
    public Stock(AbstractMediator mediator) {
        super(mediator);
    }

    //初始容量
    private static int COMPUTER_NUMBER = 100;

    /**
     * 库存增加
     * @param number 采购数量
     */
    public void increase(int number){
        COMPUTER_NUMBER = COMPUTER_NUMBER + number;
        System.out.println("库存数量为："+COMPUTER_NUMBER);
    }

    /**
     * 库存减少
     * @param number 销售数量
     */
    public void decrease(int number){
        COMPUTER_NUMBER = COMPUTER_NUMBER - number;
        System.out.println("库存数量为："+COMPUTER_NUMBER);
    }

    public int getStockNumber(){
        return COMPUTER_NUMBER;
    }

    public void cleanStock(){
        System.out.println("清理库存数量为："+COMPUTER_NUMBER);
        super.mediator.execute("stock.clear",COMPUTER_NUMBER);
    }

}
